/**
 * 未登录检查路由
 * @param path to.path
 * @param async
 */
import store from "@/store";
import {asyncRoutes} from "@/router";

export function isAccess(path,routes){
  routes.forEach(route=>{
   if(route.hasOwnProperty('children')){
     isAccess(path,route.children)
   }else if(path===route.meta.path){
      store.dispatch('access/setAccess', true).then()
   }
 })
}

export function getRouteName(role,routes){
    const a=[]
    routes.forEach(route=>{
        if(route.meta.roles&&route.meta.roles.includes(role)){
            a.push(route.name)
        }
    })
    return a
}
